<template>
  <a-modal
    title="修改子账户"
    :visible="visible"
    @ok="onSubmit"
    @cancel="onCancel"
  >
    <this-form ref="form" />
  </a-modal>
</template>
<script>
import thisForm from './edit-form.vue'
export default {
  components: { thisForm },
  data() {
    return {
      visible: false,
      // row: null,
    }
  },
  methods: {
    open(row) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.ruleForm = row
      })
    },
    onSubmit() {
      this.$refs.form.onSubmit((form) => {
        this.axios.put(`/s/sub-sellers/${form.id}`, form).then((res) => {
          this.visible = false
          this.$message.success('修改成功')
          this.$emit('refresh')
        })
      })
    },
    onCancel() {
      // Object.assign(this.form, this.row)
      this.visible = false
    },
  },
}
</script>
